/*
 * Serum
 *
 * @license      GNU Lesser General Public Licence see LICENCE-LGPL file or http://www.gnu.org/licenses/lgpl.html
 */

Serum.Message.Validate = function() {
    var msgCt;

    function createBox(t, s) {
        return ['<div class="confirmation_box valid">',
                '<h3>', t, '</h3>', s,
                '</div>'].join('');
    }

    return {
        display: function(title, format) {
            if (!msgCt) {
                msgCt = Ext.DomHelper.insertFirst(document.body, { id: 'msg-valid' }, true);
            }

            msgCt.alignTo(document, 't-t');

            var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
            var m = Ext.DomHelper.append(msgCt, { html: createBox(title, s) }, true);

            m.slideIn('t').pause(2).ghost("t", { remove: true });
        }
    };
}();